<?php
include_once 'ZCollection.php';
class ZSmtCollection extends ZCollection {
    /**
     * Get number of smt
     * @return int Number of messages
     */
    public function count(){
        return count($this->items);
    }

    /**
     * Get Smt Item Index
     * @param $index
     * @return ZSmtItem
     */
    public function getIndex($index){
        return $this->items[$index];
    }

    /**
     * Add a message
     * @param $item ZSmtItem
     */
    public function addItem($item){
        $this->items[] = $item;
    }

    /**
     * Get array of items
     * @return ZSmtItem[]
     */
    public function getItems() {
        return $this->items;
    }

    public function fetchChartData(){

        foreach($this->getItems() as $value){
            $arr[] = array($value->getSMT(), (int) $value->getNumberOfPosts());
        }
        return $arr;
    }
}